<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>XMLHttpRequest对象</title>
</head>
<body>
    <div id="demo">
        <h1>XMLHttpRequest对象</h1>
        <button type="button" onclick="loadDoc()">更改内容</button>
    </div>
<script>
    function loadDoc(){
        const xttp = new XMLHttpRequest();
        xttp.onreadystatechange = function (){
            if(this.readyState == 4 && this.status==200){
                document.getElementById("demo").innerHTML = this.responseText;
            }
        };
        xhhtp.open("GET","/demo/js/ajax_info.txt");
        xttp.send();
    }
</script>
</body>
</html>